<template>
  <div class="NewsList">
    <van-card v-for="item in newsList"
              :key="item.id"
              :title="item.title"
              :thumb="item.img_url"
              @click="getDetail('/home/newsinfo',item.id)">
      <div slot="price">{{item.add_time}}</div>
      <div slot="num">点击了{{item.click}}次</div>
    </van-card>
  </div>
</template>
<script>
// import axios from 'axios'
export default {
  data: () => ({ newsList: [] }),
  created () {
    this.getNewsList()
  },
  methods: {
    async getNewsList () {
      try {
        const res = await this.Api.getNewsList()
        const {
          data: { message }
        } = res
        this.newsList = message
      } catch (error) {
        this.$Toast('新闻列表请求失败')
      }
    }
  }
}
</script>
<style lang="less" scoped>
.van-card__thumb {
  height: 60px;
}
.van-card__content {
  min-height: 60px;
  .van-card__title {
    font-weight: 600;
    color: #222;
    letter-spacing: 1px;
  }
  .van-card__price {
    color: red;
  }
}
</style>
